﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using BUS;

namespace QuanLyCongDoanVien.UserControls
{
    public partial class ucThemToCongDoan : UserControl
    {
        public ucThemToCongDoan()
        {
            InitializeComponent();
        }

        private void btnHuy_Click(object sender, EventArgs e)
        {
            this.txtTenToCongDoan.Text = "";
        }

        private void btnLuu_Click(object sender, EventArgs e)
        {
            ToCongDoanDTO toCongDoanDto = new ToCongDoanDTO(txtTenToCongDoan.Text.Trim());
            try
            {
                int iResult = ToCongDoanBUS.Them(toCongDoanDto);
                if (iResult == 1)
                {
                    MessageBox.Show("Đã thêm tổ công đoàn");
                    txtTenToCongDoan.Text = "";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
